import 'package:flutter/cupertino.dart';
// import 'package:rongcloud_im_plugin/rongcloud_im_plugin.dart';
import 'package:common/module/module_manager.dart';

abstract class GlobalBroadcast {
  static void send(GlobalEvent event) {
    ModuleManager().eventHandlers?.forEach((element) {
      element(event);
    });
  }
}

abstract class GlobalEvent {}

class GlobalRequestUserInfoEvent extends GlobalEvent {
  final String token;

  GlobalRequestUserInfoEvent(this.token);
}

class GlobalAnalyticsEvent extends GlobalEvent {
  final String key;

  GlobalAnalyticsEvent(this.key);
}

class GlobalLoginEvent extends GlobalEvent {}

class GlobalLogoutEvent extends GlobalEvent {}

class GlobalDutyManagerEvent extends GlobalEvent {
  Map<String, dynamic> map;
  BuildContext context;

  GlobalDutyManagerEvent(this.map, this.context);
}

class GlobalMessageLoginResultEvent extends GlobalEvent {
  bool success;
}

class GlobalIMLoginResultEvent extends GlobalEvent {
  bool success;
  String userId;

  GlobalIMLoginResultEvent(this.success, this.userId);
}

class GlobalMessageEvent extends GlobalEvent {
  // final Message message;
  //
  // GlobalMessageEvent(this.message);
}

class GlobalOfflineUpdateEvent extends GlobalEvent{
  final bool isOffline;
  GlobalOfflineUpdateEvent(this.isOffline);
}

class GlobalIMDownEvent extends GlobalEvent {}
